package com.sdy.dcsb.biz.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sdy.dcsb.biz.mapper.EsbScriptMapper;
import com.sdy.dcsb.biz.model.EsbScript;
import com.sdy.dcsb.biz.model.dto.EsbScriptDto;
import com.sdy.dcsb.biz.model.vo.EsbScriptVo;
import com.sdy.dcsb.biz.service.EsbScriptService;
import com.sdy.mvc.service.impl.BaseServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Snaky
 * @date 2020/4/21
 */
@Slf4j
@Service
public class EsbScriptServiceImpl extends BaseServiceImpl<EsbScript> implements EsbScriptService {
    @Autowired
    private EsbScriptMapper mapper;

    /**
     * 通过封装接口id查询关联所有接口脚本信息
     *
     * @param id 封装接口id
     * @return 脚本集合
     */
    @Override
    public List<EsbScriptDto> getAllScriptByEncapsulationId(Integer id) {
        return mapper.getAllScriptByEncapsulationId(id);
    }

    /**
     * 查询已存在脚本分页数据
     * @param page 分页信息
     * @param name 脚本名称
     * @return 分页数据
     */
    @Override
    public IPage<EsbScriptVo> getPageData(Page<?> page, String name) {
        return mapper.getPageData(page,name);
    }

    /**
     * 查询脚本详情，包含已关联接口信息
     *
     * @param id 脚本id
     * @return 脚本详情
     */
    @Override
    public EsbScriptVo getDetail(Integer id) {
        return mapper.getDetail(id);
    }

}
